{* $Id$ *}
{include_core file="admin/lib/header.html" title="保证金类型展示"}
{if empty($search_filter) && empty($bargain_money_type_list) && $status != 0 && 1 != 1}
  <div class="search-none search-none-bg">
    <p>还没有保证金类型发布，点击<a href="{AnUrl('user_money/admin/bargain_money_type/add')}" class="search-none-add">添加保证金类型</a></p>
  </div>
{else}
  <div class="page-header border-bottom clearfix">
    <h2 class="left">保证金类型管理<span>在这里对保证金类型进行管理</span></h2>
    <a href="{AnUrl('user_money/admin/bargain_money_type/add')}" class="btn btn-success btn-sm right"><i class="icon-add"></i>添加保证金类型</a>
  </div>
  <!--start:列表-->
  <table class="list-table">
    <caption>按状态：
      <a href='{AnUrl("user_money/admin/bargain_money_type?status=1")}' {if $status == 1} class="label label-primary" {else} class="label label-default" {/if}>正常</a>
      <a href='{AnUrl("user_money/admin/bargain_money_type?status=0")}' {if $status == 0} class="label label-primary" {else} class="label label-default" {/if}>已删除</a>
    </caption>
    <thead><tr>
      <th>类型名称</th>
      <th style="width:130px;">操作</th>
    </tr></thead>
    <tbody>
      {foreach $bargain_money_type_list as $k=>$v}
        <tr id="datalist{$v.id}">
          <td>{$v.res_name}</td>
          <td>
            {if $status == 1}
              <a href="{AnUrl("user_money/admin/bargain_money_type/edit?id={$v.id}")}" class="btn btn-info btn-xs"><i class="icon-edit icon-white"></i>编辑</a>
              <a href="{AnUrl("user_money/admin/bargain_money_type/delete?id={$v.id}")}" class="btn btn-danger btn-xs js_deleteOne"><i class="icon-trash icon-white"></i>删除</a>
            {elseif $status == 0}
              <a href="{AnUrl("user_money/admin/bargain_money_type/change_status?id={$v.id}")}" class="btn btn-success btn-xs"><i class="icon-trash icon-white"></i>恢复</a>
            {/if}
          </td>
        </tr>
        {if $v.type_list}
          {foreach $v.type_list as $key=>$val}
            <tr id="datalist{$v.id}">
              <td>&nbsp;&nbsp;|--&nbsp;&nbsp;{$val.res_name}</td>
              <td>
                {if $status == 1}
                  <a href="{AnUrl("user_money/admin/bargain_money_type/edit?id={$val.id}")}" class="btn btn-info btn-xs"><i class="icon-edit icon-white"></i>编辑</a>
                  <a href="{AnUrl("user_money/admin/bargain_money_type/delete?id={$val.id}")}" class="btn btn-danger btn-xs js_deleteOne"><i class="icon-trash icon-white"></i>删除</a>
                {elseif $status == 0}
                  <a href="{AnUrl("user_money/admin/bargain_money_type/change_status?id={$val.id}")}" class="btn btn-success btn-xs"><i class="icon-trash icon-white"></i>恢复</a>
                {/if}
              </td>
            </tr>

          {/foreach}
        {/if}
      {foreachelse}
          <tr><td class="txtleft" colspan="6">暂无数据</td></tr>
      {/foreach}
    </tbody>
  </table>
  {include_core file="admin/lib/pager.html"}
{/if}
<!--end:列表-->
{load_js file='zclip/jquery.zclip.min.js'}
{load_js file='zclip/ZeroClipboard.js'}
<script>
$(function(){

  // 单个禁用
  $(".js_deleteOne").live('click',function(e){
    e.preventDefault();
    e.stopPropagation();
    var selectId = $(this).closest("tr").attr("id").substring(8);
    var roleId = $(this).closest("tr").data("id");
    if (!selectId) {
      alert('请选择要操作记录');
    }
    
    var clickObj = $(this);
    var url = clickObj.attr("href");
    var cardListBox = clickObj.closest('.cardListBox');
    var lines = $(this).parent().attr('rowspan');
    showConfirm('确定要禁用该条记录吗？', 1, function(){
      $.post(url, {  'id':selectId }, function(json){
        var reg = /ok/;
        if (!reg.test(json)) {
          alert(json);
        } else {
          clickObj.closest("tr").fadeOut(function(){
            if (lines) {
              for (var i = 1; i < lines; i++) {
                $(this).next().remove();
              }
            };
            $(this).remove();
            interLineColor();
            
            if (cardListBox) {
              var trNum = cardListBox.find('.js_deleteOne').length;
              var level_total = cardListBox.attr('data-level_total');
              if (trNum < level_total) {
                $('.addCard').show();
              }
            }
          });
        }
      });
    });
    return false;
  });

});
</script>
{include_core file="admin/lib/footer.html"}